package com.duda.dao;

import com.duda.projo.DownFileUser;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;
import java.util.UUID;

@Mapper
public interface DownFileUserMapper {
    @Select("select * from APP_DownFileUser where ID=#{userId}")
    List<DownFileUser> getUserFileUserById(String userId);

    @Select("select * from APP_DownFileUser where UserName=#{userName} and PassWord=#{passWord}")
    List<DownFileUser> getUserFileUser(String userName, String passWord);

    @Select("update APP_DownFileUser set Integral=Integral-100 where ID=#{userID}")
    void deductUserIntegral(String userID);

    @Insert("insert into APP_DownFileUser(ID,UserName,PassWord,Integral,CreateTime) " +
            "values(#{userID},#{userName},#{passWord},#{integral},#{createTime})")
    void insertUser(UUID userID, String userName, String passWord, int integral, String createTime);
}
